home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
pasprog.EXE
/
TAKVIMTP.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-09-24
|
4KB
|
171 lines
Unit Takvimtp;
Interface
Uses Crt,Dos;
Const
Count:Array[1..12] Of Byte=(31,28,31,30,31,30,31,31,30,31,30,31);
Month:Array[1..12] Of String[7]=('Ocak ','₧ubat ','Mart ','Nisan '
,'Mayìs ','Haziran','Temmuz ','Agustos'
,'Eylül ','Ekim ','Kasìm ','Aralìk ');
Type
Callendar = ^Cal;
Cal = Object
Day :Word;
Mon :Word;
Yea :Word;
DoW :Word;
Ox :Integer;
Oy :Integer;
Save:Array[1..4000] of Byte;
Constructor Init(X,Y:Integer);
Procedure SetMonth(M:Integer);
Procedure SetDay(D:Integer);
Procedure Page;Virtual;
Procedure Mover(Mx,My:Integer);
Procedure Show;Virtual;
Procedure ExitMessage;Virtual;
Function Reader:Word;
Procedure HandleEvent(Key:Word);Virtual;
Destructor Done;
End;
Var
XX,YY:Integer;
Implementation
function Segment:word;
begin
if (mem[0:$0410] and $30)=$30 then segment:=$b000
else segment:=$b800;
end;
procedure HideCursor;Assembler;
Asm
Mov Ax,0100h
Mov Cx,1f00h
Int 10h
end;
procedure StdCursor;Assembler;
Asm
Mov Ax,0100h
Mov Cx,1e1fh
Int 10h
end;
Constructor Cal.Init(X,Y:Integer);
Begin
Ox:=X;
Oy:=Y;
xx:=WhereX;
yy:=WhereY;
Move(Mem[Segment:0],Save[1],4000);
GetDate(Yea,Mon,Day,DoW);
HideCursor;
Show;
End;
Procedure Cal.SetMonth(M:Integer);
Begin
Mon:=Mon+M;
If Mon<1 Then Begin Mon:=12; Yea:=Yea-1; End;
If Mon>12 Then Begin Mon:=1; Yea:=Yea+1; End;
Show;
End;
Procedure Cal.SetDay(D:Integer);
Begin
Day:=Day+D;
If Day<1 Then Begin Mon:=Mon-1; Day:=Count[Mon]; End;
If Day>Count[Mon] Then Begin Mon:=Mon+1; Day:=1 End;
Show;
End;
Procedure Cal.Page;
Begin
Move(Save,Mem[Segment:0],4000);
TextColor(14);
TextBackGround(1);
GotoXY(Ox,Oy); Writeln('╔[■]════════════════════════╗');
GotoXY(Ox,Oy+1); Writeln('║ ║');
GotoXY(Ox,Oy+2); Writeln('╠═══╦═══╦═══╦═══╦═══╦═══╦═══╣');
GotoXY(Ox,Oy+3); Writeln('║Pzr║Pts║Sal║Çrƒ║Prƒ║Cum║Cts║');
GotoXY(Ox,Oy+4); Writeln('╠═══╬═══╬═══╬═══╬═══╬═══╬═══╣');
GotoXY(Ox,Oy+5); Writeln('║ ║ ║ ║ ║ ║ ║ ║');
GotoXY(Ox,Oy+6); Writeln('║ ║ ║ ║ ║ ║ ║ ║');
GotoXY(Ox,Oy+7); Writeln('║ ║ ║ ║ ║ ║ ║ ║');
GotoXY(Ox,Oy+8); Writeln('║ ║ ║ ║ ║ ║ ║ ║');
GotoXY(Ox,Oy+9); Writeln('║ ║ ║ ║ ║ ║ ║ ║');
GotoXY(Ox,Oy+10);Writeln('║ ║ ║ ║ ║ ║ ║ ║');
GotoXY(Ox,Oy+11);Writeln('╚═══╩═══╩═══╩═══╩═══╩═══╩═══╝');
End;
Procedure Cal.Mover(Mx,My:Integer);
Begin
Ox:=Mx+Ox;
Oy:=My+Oy;
If Ox<=0 Then Ox:=50 Else If Ox>50 then Ox:=1;
If Oy<=0 Then Oy:=13 Else If Oy>13 then Oy:=1;
Show;
End;
Procedure Cal.Show;
Var
AKey : Word;
Sx,Sy,Nx : Integer;
Day1,DoW1: Word;
Begin
Page;
GotoXY(Ox+8,Oy+1);
Write(Month[Mon],' ',Yea);
Sy:=Oy+5;
SetDate(Yea,Mon,1);
GetDate(Yea,Mon,Day1,DoW1);
SetDate(Yea,Mon,Day);
If (Mon=2) And (Yea Mod 4=0) Then Count[2]:=29;
Sx:=Ox+1+Dow1*4;
For Nx:=1 To Count[Mon] Do
Begin
If Day=Nx Then TextColor(14+16);
GotoXY(Sx,Sy);
Write(Nx);
If Day=Nx Then TextColor(14);
Sx:=Sx+4;
If Sx>=Ox+28 Then
Begin
Sy:=Sy+1;
Sx:=Ox+1;
End;
End;
Repeat
AKey:=Reader;
HandleEvent(AKey);
Until 1=2;
End;
Function Cal.Reader:Word;
Var
Key : Char;
Begin
Key:=ReadKey;
If (Key=#0) And KeyPressed Then
Begin
Key:=ReadKey;
Reader:=Ord(Key) Shl 8;
End Else Reader:=Ord(Key);
End;
Procedure Cal.HandleEvent(Key:Word);
Begin
Case Key Of
20736:SetMonth(-1);
18688:SetMonth(1);
45 :SetDay(-1);
43 :SetDay(1);
19712:Mover(1,0) ;
19200:Mover(-1,0);
18432:Mover(0,-1);
20480:Mover(0,1) ;
27 :Done;
End;
End;
Procedure Cal.ExitMessage;
Begin
GotoXY(xx,yy);ClrEol;
Writeln('TurboSoft Callendar by Murat AKSARAY');
End;
Destructor Cal.Done;
Begin
Move(Save,Mem[Segment:0],4000);
ExitMessage;
StdCursor;
Halt;
End;
End.